package com.yao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yao.entity.User;
import com.yao.mapper.UserMapper;
import com.yao.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author YaoXJ
 * @Date 2023-07-18
 * @Description
 */
@Service
public class UserServiceImpl implements IUserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public Integer addUser(User user) {
        user.setRegistTime(new Date());
        return userMapper.insert(user);
    }

    @Override
    public User queryUser(User user) {
        QueryWrapper<User> queryWrapper = new QueryWrapper();
        queryWrapper.eq("id",user.getId());
        return userMapper.selectOne(queryWrapper);
    }
}
